Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby: Workaround for ucrt. #8518

Merged
merged 1 commit into from
May 1, 2021
Merged

ruby: Workaround for ucrt. #8518

merged 1 commit into from
May 1, 2021

Conversation

Biswa96
Copy link
Member

@Biswa96 Biswa96 commented Apr 30, 2021

Please test this! 📢

@jeremyd2019
Copy link
Member

I just got pdcurses building with clang, so I could give this a try (with graphviz commented out). Unfortunately it crashed clang 💣

@Biswa96
Copy link
Member Author

Biswa96 commented May 1, 2021

What was crashed? At ruby build time the tests succeed.

@jeremyd2019
Copy link
Member

jeremyd2019 commented May 1, 2021

The clang compiler itself... This may be related to #8493 and msys2/CLANG-packages#3 @mati865 ?

clang backtrace
fatal error: error in backend: IO failure on output stream: Invalid argument
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: C:\msys64\clang64\bin\x86_64-w64-mingw32-clang.exe -E -DRUBY_EXPORT -I. -I.ext/include/x64-mingw32 -I../ruby-3.0.1/include -I../ruby-3.0.1 -I../ruby-3.0.1/enc/unicode/12.1.0 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -IC:/msys64/clang64/include -IC:/msys64/clang64/include/pdcurses -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT ../ruby-3.0.1/version.c
make: *** [uncommon.mk:820: .rbconfig.time] Error 139
 #0 0x00007ffa402f4b59 (C:\Windows\System32\KERNELBASE.dll+0x34b59)
 #1 0x00007ffa010c0aca llvm::CrashRecoveryContext::HandleExit(int) (C:\msys64\clang64\bin\libLLVM.dll+0x80aca)
 #2 0x00007ffa0118b7d2 llvm::sys::Process::Exit(int) (C:\msys64\clang64\bin\libLLVM.dll+0x14b7d2)
 #3 0x00007ff769856851 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (C:\msys64\clang64\bin\x86_64-w64-mingw32-clang.exe+0x6851)
 #4 0x00007ffa010ce013 llvm::report_fatal_error(llvm::Twine const&, bool) (C:\msys64\clang64\bin\libLLVM.dll+0x8e013)
 #5 0x00007ffa010ce0ea llvm::report_fatal_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) (C:\msys64\clang64\bin\libLLVM.dll+0x8e0ea)
 #6 0x00007ffa01172122 llvm::raw_fd_ostream::~raw_fd_ostream() (C:\msys64\clang64\bin\libLLVM.dll+0x132122)
 #7 0x00007ffa0117213d llvm::raw_fd_ostream::~raw_fd_ostream() (C:\msys64\clang64\bin\libLLVM.dll+0x13213d)
 #8 0x00007ffa07464f20 clang::CompilerInstance::clearOutputFiles(bool) (C:\msys64\clang64\bin\libclang-cpp.dll+0x18a4f20)
 #9 0x00007ffa074b87c8 clang::FrontendAction::EndSourceFile() (C:\msys64\clang64\bin\libclang-cpp.dll+0x18f87c8)
#10 0x00007ffa074672f8 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (C:\msys64\clang64\bin\libclang-cpp.dll+0x18a72f8)
#11 0x00007ffa075243c3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (C:\msys64\clang64\bin\libclang-cpp.dll+0x19643c3)
#12 0x00007ff7698563f5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (C:\msys64\clang64\bin\x86_64-w64-mingw32-clang.exe+0x63f5)
#13 0x00007ff769854501 main (C:\msys64\clang64\bin\x86_64-w64-mingw32-clang.exe+0x4501)
#14 0x00007ffa07146a66 clang::driver::JobList::clear() (C:\msys64\clang64\bin\libclang-cpp.dll+0x1586a66)
#15 0x00007ffa010c0aa1 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (C:\msys64\clang64\bin\libLLVM.dll+0x80aa1)
#16 0x00007ffa07146539 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*) const (C:\msys64\clang64\bin\libclang-cpp.dll+0x1586539)
#17 0x00007ffa0711add9 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (C:\msys64\clang64\bin\libclang-cpp.dll+0x155add9)
#18 0x00007ffa0711b2f5 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const (C:\msys64\clang64\bin\libclang-cpp.dll+0x155b2f5)
#19 0x00007ffa07130056 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) (C:\msys64\clang64\bin\libclang-cpp.dll+0x1570056)
#20 0x00007ff769853f64 main (C:\msys64\clang64\bin\x86_64-w64-mingw32-clang.exe+0x3f64)
#21 0x00007ff7698513ea WinMainCRTStartup (C:\msys64\clang64\bin\x86_64-w64-mingw32-clang.exe+0x13ea)
#22 0x00007ff769851446 mainCRTStartup (C:\msys64\clang64\bin\x86_64-w64-mingw32-clang.exe+0x1446)
#23 0x00007ffa40e17034 (C:\Windows\System32\KERNEL32.DLL+0x17034)
#24 0x00007ffa42582651 (C:\Windows\SYSTEM32\ntdll.dll+0x52651)
make: *** [uncommon.mk:754: x64-mingw32-fake.rb] Error 139

@jeremyd2019
Copy link
Member

As far as the actual patch involved, it seems like it should be possible to retrieve the value of __MSVCRT_VERSION__ via some objdump magic rather than conditionally applying that patch to change the default. That'd be some deep autoconf magic though, I'm not sure about that. It'd be easier to assume native and just run the output to print out the value, but it looks like the existing autoconf code is trying to deal with cross-compilation.

@Biswa96
Copy link
Member Author

Biswa96 commented May 1, 2021

Ruby has their own RUBY_MSVCRT_VERSION condition which is not as same value as __MSVCRT_VERSION__ in mingw-w64 but RUBY_MSVCRT_VERSION >= 140 seems to work with UCRT, like in corecrt.h in migw-w64.

@lazka
Copy link
Member

lazka commented May 1, 2021

"hello world" works, good enough :P

@lazka lazka merged commit c551044 into msys2:master May 1, 2021
@Biswa96 Biswa96 deleted the ruby-ucrt branch May 1, 2021 06:51
@mati865
Copy link
Collaborator

mati865 commented May 1, 2021

That's weird, Clang crashed when removing temporary files.
I'll be looking at LLVM 12 upgrade today maybe this is fixed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants